#include <stdio.h>


int Ex4_4() {
    int tabA[400], tabB[400];
    int dim,maxval;
    int tabX[100];
    int ind,equal;

    printf("Enter the dimension of the arrays:\n");
    scanf("%d",&dim);
    for(ind=0;ind<=dim-1;ind=ind+1)
    {
        printf("Enter an integer for tabA:\n");
        scanf("%d",&tabA[ind]);
    }
    for(ind=0;ind<=dim-1;ind=ind+1)
    {
        printf("Enter an integer for tabB:\n");
        scanf("%d",&tabB[ind]);
    }
    printf("enter the maxval:\n");
    scanf("%d",&maxval);
    for(ind=0;ind<=maxval-1;ind=ind+1)
    {
        tabX[ind] = 0;
    }
    for(ind=0;ind<=dim-1;ind=ind+1)
    {
        tabX[tabA[ind]] = tabX[tabA[ind]]+1;
        tabX[tabB[ind]] = tabX[tabB[ind]]-1;
    }

    equal = 1;
    ind = 0;

    while(equal==1&&ind<=maxval-1)
    {
        if(tabX[ind]!=0)
            equal = 0;
        else
            ind = ind+1;
    }

    if(equal ==1)
        printf("these arrays are the same!\n");
    else
        printf("these arrays are different!\n");

    return 0;
}
